package org.jeik.beackBeans.forms;


import javax.faces.application.FacesMessage;


import org.jeik.beackBeans.BeansBase;
import org.jeik.common.Constants;
import org.jeik.controllers.SystemMsgs;
import org.jeik.controllers.MsgsController;
import org.jeik.controllers.NavigationController;
import org.jeik.controllers.NavigationRule;
import org.jeik.utils.EmailUtils;
import org.jeik.utils.EmailUtils.EmailType;

public class EmploymentFormBean extends BeansBase {

	private static final long serialVersionUID = 1L;
	
	private String name;
	private String email;
	private String phone;
	private String education;
	private String wantedJob;
	private String expertises;
	
	/**
	 * 
	 */
	public void submitForm(){
		
		
		
		String emailBody = "<html dir=\"rtl\"><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\"></head><body>";
		emailBody += "<table style='font-size:13px;font-family:Tahoma;'>";
		emailBody += "<tr><td style='width:150px;font-weight:bold;vertical-align:top;'>الإسم</td><td style='width:500px;'>" + getName() + "</td></tr>";
		emailBody += "<tr><td style='font-weight:bold;vertical-align:top;'>البريد الإلكتروني</td><td>" + getEmail() + "</td></tr>";
		emailBody += "<tr><td style='font-weight:bold;vertical-align:top;'>الهاتف</td><td>" + getPhone() + "</td></tr>";
		emailBody += "<tr><td style='font-weight:bold;vertical-align:top;'>المؤهل العلمي</td><td>" + getEducation() + "</td></tr>";
		emailBody += "<tr><td style='font-weight:bold;vertical-align:top;'>المهنة المطلوبة</td><td>" + getWantedJob() + "</td></tr>";
		emailBody += "<tr><td style='font-weight:bold;vertical-align:top;'>الخبرات</td><td>" + getExpertises() + "</td></tr>";
		emailBody += "</table></body></html>";
		
		EmailUtils.sendEmail("info@jordanembassykw.com", "Job Application at Jordan Embassy Website", Constants.Configs.EMPLOYMENT_EMAIL , "طلب توظيف",emailBody , EmailType.HTML);
		
		MsgsController.addFacesGlobalMessage(FacesMessage.SEVERITY_INFO, SystemMsgs.MESSAGE_SENT_SUCCESSFULLY);
		
		NavigationController.navigate(NavigationRule.RESULT);
		
		
	}
	
	
	/**
	 * 
	 * @return
	 */
	public String getName() {
		return name;
	}

	/**
	 * 
	 * @param name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * 
	 * @return
	 */
	public String getEmail() {
		return email;
	}

	/**
	 * 
	 * @param email
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * 
	 * @return
	 */
	public String getPhone() {
		return phone;
	}

	/**
	 * 
	 * @param phone
	 */
	public void setPhone(String phone) {
		this.phone = phone;
	}

	/**
	 * 
	 * @return
	 */
	public String getEducation() {
		return education;
	}

	/**
	 * 
	 * @param education
	 */
	public void setEducation(String education) {
		this.education = education;
	}

	/**
	 * 
	 * @return
	 */
	public String getWantedJob() {
		return wantedJob;
	}

	/**
	 * 
	 * @param wantedJob
	 */
	public void setWantedJob(String wantedJob) {
		this.wantedJob = wantedJob;
	}

	/**
	 * 
	 * @return
	 */
	public String getExpertises() {
		return expertises;
	}

	/**
	 * 
	 * @param expertises
	 */
	public void setExpertises(String expertises) {
		this.expertises = expertises;
	}
	
	
	
	
	
}
